# -*- coding: utf-8 -*-
from datasets import load_dataset, load_from_disk

try:
    # 尝试从本地加载数据集
    dataset = load_from_disk('D:/test_transformers01/stance/T5/nlpcc_2017')
    print("数据集加载成功。")
except FileNotFoundError as e:
    print(f"加载数据集失败: {e}")
    # 从 Hugging Face Hub 加载数据集
    dataset = load_dataset('nlpcc_2017')
    # 保存数据集到本地
    dataset.save_to_disk('D:/test_transformers01/stance/T5/nlpcc_2017')
    print("数据集已重新保存，请重新运行程序。")